package com.hqyj.dao;


import com.hqyj.pojo.Customer;
import com.hqyj.pojo.Manager;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface ManagerDao {
    @Select("select * from manager1 where name=#{name} and pwd=#{pwd}")
    Manager login(Manager user);
    @Select("select * from manager1 where name=#{name}")
    Manager selectByName(Manager user);
    @Insert("INSERT into manager1 (name,idcard,salt,sex,birth,phone,eaddress,education,remarks,pwd) VALUES (#{name},#{idcard},#{salt},#{sex},#{birth},#{phone},#{eaddress},#{education},#{remarks},#{pwd})")
    boolean register(Manager manager);
    @Select("select count(*) from manager1 where name=#{name}")
    int valName(Manager manager);
    @Select("SELECT eaddress from manager1 where name=#{name}")
    String selectEmail(Manager manager);
    @Select("select * from customer1 where manager=#{name}")
    List<Customer> selectByManger(Manager manager);
    @Select("select * from customer1 where id=#{conValue} and manager = #{name}")
    List<Customer> findByUserId(Manager manager);
    @Select("select * from customer1 where name=#{conValue} and manager = #{name}")
    List<Customer> findByUserName(Manager manager);
    @Select("select * from customer1 and manager=#{name}")
    List<Customer> select();
    @Update("update manager1 set photo=#{photo} where name=#{name}")
    boolean updateHead(Manager manager);
}
